<%--
  Created by IntelliJ IDEA.
  User: Asking-mac
  Date: 2022/8/1
  Time: 10:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册页</title>

    <script src="js/jquery-3.6.0.min.js"></script>

</head>
<body>
    <form action="RegisterServlet" id="form1">
        账号:<input type="text" name="username" id="username"> <br>
        密码:<input type="password" name="password" id="mm1">
        <input type="button" value="显示/隐藏" onclick="xsyc()"><br>
        确认密码:<input type="text" name="password" id="mm2"> <br>
        <input type="button" value="注册" onclick="func()">
    </form>
</body>

<script>
    function func(){

    	let zh = $("#username").val();
    	if(zh.length < 6 || zh.length > 15){
    		alert("账号长度必须介于6到15位之间");
    		return;
        }


    	let mm1 = $("#mm1").val();
    	let mm2 = $("#mm2").val();
    	if(mm1 != mm2){
    		alert("注册时两次密码不一致");
    		return ;
        }
    	$("#form1").submit();
    }


    function xsyc(){
    	let mm1type = $("#mm1").attr("type");

    	if(mm1type == "text"){
			$("#mm1").attr("type","password");
        }else{
			$("#mm1").attr("type","text");
        }
    }



</script>


</html>
